<template>
	<view>
		<view class="background"></view>
		<navView :navTitle="type == 1 ? '成交项目' : '进行项目' " backgroundColor="#008efe" titleColor="#fff" :isBack="true">
		</navView>
		<view class="project-box">
			<!-- <view class="quan">
				全选
			</view> -->
			<view class="project-list2" v-if="type==1">
				<view class="project-card" v-for="(project, index) in projects.completedProjects" :key="index">
					<!-- 项目名称和状态 -->
					<view class="project-header">
						<text>{{ project.name }}</text>
					</view>

				</view>
			</view>
			<view class="project-list2" v-else>
				<view class="project-card" v-for="(project, index) in projects.pendingProjects" :key="index">
					<!-- 项目名称和状态 -->
					<view class="project-header">
						<text>{{ project.name }}</text>
					</view>
				</view>
			</view>
			<view v-if="projects.completedProjects && projects.pendingProjects" class="no-data-box">				
				<text class="empty-text">暂无项目数据</text>
			</view>
		</view>
	</view>

</template>

<script>
export default {
	data() {
		return {
			id: '',
			type: 1,
			projects: [],
			showSalePhone: [],
			showTechnologyPhone: [],
			showFinancePhone: [],
			showExecutivePhone: [],
		}
	},
	onLoad(option) {
		console.log(option, 'option')
		this.id = option.id
		this.type = option.type
		this.getCustomerProject()
	},
	mounted() {
		this.projects.forEach(() => {
			this.showSalePhone.push(false);
			this.showTechnologyPhone.push(false);
			this.showFinancePhone.push(false);
			this.showExecutivePhone.push(false);
		});
	},
	methods: {
		getCustomerProject() {
			this.$request('/addons/qingdong/customer/customerDetail', 'GET', {
				id: this.id
			}).then(res => {
				console.log(res.data, 'company')
				this.projects = res.data
			})
		}
	}
}
</script>

<style lang="scss">
.no-data-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 100rpx 0;

	.empty-icon {
		width: 240rpx;
		height: 240rpx;
		margin-bottom: 40rpx;
	}

	.empty-text {
		color: #999;
		font-size: 28rpx;
	}
}
.background {
	background: #f5f6f9;
	width: 100%;
	height: 100vh;
	position: fixed;
	top: 0;
	left: 0;
	z-index: -1;
}

.project-box {
	padding: 20rpx;
	box-sizing: border-box;

	.quan {
		color: #999999;
	}

	.project-list2 {
		border-radius: 16rpx;

		.project-card {
			overflow: hidden;
			margin-bottom: 20rpx;
			padding: 20rpx;
			background-color: #fff;
			margin: 20rpx 0;

			.project-header {
				display: flex;
				align-items: center;
				margin-bottom: 10rpx;

				text {
					font-size: 32rpx;
					font-weight: bold;
				}
			}

			.project-detail {
				font-size: 28rpx;
				color: #333;
				margin-bottom: 20rpx;
				display: flex;
				align-items: center;

				.userbox {
					position: relative;
				}

				.phone-wrapper {
					position: absolute;
					bottom: -50rpx;
					left: 0;
					z-index: 10;
					display: flex;
					align-items: center;
					margin-top: 10rpx;
					background: #fff;
					box-shadow: 0 2rpx 6rpx 2rpx #c1c1c1;
					padding: 3rpx 5rpx;
					box-sizing: 10rpx;

					.image {
						width: 32rpx;
						height: 32rpx;
						margin-right: 10rpx;
					}
				}
			}

			.tab-bar {
				display: flex;
				justify-content: space-between;
				margin-bottom: 20rpx;

				.tab-item {
					width: 20%;
					text-align: center;
					padding: 8rpx 0;
					background-color: #e0f1ff;
					border-radius: 10rpx;
					color: #007aff;
					font-size: 24rpx;
				}
			}

			.service-evaluation {
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 24rpx;
				color: #E56C2B;
				background-color: #F5F5F5;
				padding: 10rpx 10rpx;
				box-sizing: border-box;
				border-radius: 10rpx;

				.right {
					width: 8rpx;
					height: 16rpx;
					margin-left: 20rpx;
				}
			}
		}
	}
}
</style>